<?php
/**
 * actions.php - actions processing.
 *
 * NMIT BIT Project - Infinity - A 3D Website using WebGL & HTML5 Technology
 * Infinity Grid Version 
 * Version: 0.1.2
 *
 * Author: William Liu <qzliuyuzou@gmail.com> <lyzdev@gmail.com>
 *
 * Required Server Version:
 *  PHP5 or higher
 *  MySQL 5 or higher
 *
 * Required Browser Version:
 *  Google Chrome 9 or higher
 *  Mozilla Firefox 4 Beta or higher
 *  *Apple Safari
 *
 * Copyright (c) 2011, William Liu All rights reserved.
 * Infinity is an open source 3D website project
 * Under Apache License 2.0 
 * http://www.lyzsoft.cn
 * http://7cloud.wordpress.com
 *
 * Project Starting date: 9/3/2011
 * Update Date 1: 12/5/2011
 * Update Date 2: 5/6/2011 - Beta 2
 *
**/
?>

<?php
//deny the access directly
if(!defined('INCLUDE_CHECK')) die('Access Forbidden! You are not allow to execute this file directly!');


//logout action reaction
$action = $_GET["action"];

//logout
if ($action == "logout")
{
	unset($_SESSION['username']);  
	//unset($_SESSION['password']);  
	unset($_SESSION['user_level']);  
	echo "<div class=\"loginmsg\">Logout Success! Redirect to front page after 5 seconds!</div>";
	echo "<script language=\"JavaScript\">window.setTimeout(\"window.location.href=\'index.php\'\", 5000); </script>";
	}
	
//register
if ($action == "reg")
{
	echo "<script>url=\"reg.php\";window.location.href=url;</script>";
	//header ("Location:reg.php");
	}

//delete function
if ($action == "del")
{
	$delID = (int)$_GET['id'];
	$delQuery = mysql_query("DELETE FROM msg WHERE id='$delID'") or die(mysql_error());
	echo "deleted!";
	echo "<script>url=\"admin.php\";window.location.href=url;</script>";
	//header ("Location:admin.php");
	}
?>
